
public class Triangle {

    public void printAsteriskInOneLine(int num) {
        printSymbols(num, "*");
        System.out.println();
    }

    public void printAsteriskInOneColumn(int num) {
        for (int i = 0; i < num; i ++){
            printAsteriskInOneLine(1);
        }
    }

    public void printRightTriangle(int num) {
        for (int i = 1; i <= num; i ++){
            printAsteriskInOneLine(i);
        }
    }

    public void printIsoscelesTriangle(int num) {
        for (int i = 1; i <= num; i ++){
            printSymbols(num - i, " ");
            printSymbols(i * 2 - 1, "*");
            System.out.println();
        }
    }

    private void printSymbols(int num, String sym) {
        for (int i = 0; i < num; i ++){
            System.out.print(sym);
        }
    }

    public void printDiamond(int num) {
        printIsoscelesTriangle(num);
        printInverseIsoscelesTriangle(num - 1);
    }

    private void printInverseIsoscelesTriangle(int num) {
        for (int i = num; i > 0; i --){
            printSymbols(num - i + 1, " ");
            printSymbols(i * 2 - 1, "*");
            System.out.println();
        }
    }

    public void printDiamondWithName(int num, String name) {
        for (int i = 1; i < num; i ++){
            printSymbols(num - i, " ");
            printSymbols(i * 2 - 1, "*");
            System.out.println();
        }
        System.out.println(name);
        printInverseIsoscelesTriangle(num - 1);
    }
}
